import Vue from 'vue'
import VueRouter from 'vue-router'
import RouteLayout from '@/components/layout/RouteLayout.vue'
import RouteEmpty from '@/components/layout/RouteEmpty.vue'

Vue.use(VueRouter)
// dataMonitoring
const asyncRoutes = [
  {
    path: '/air',
    name: 'Air',
    meta: {
      title: '空气监测'
    },
    component: RouteEmpty,
    children: [
      {
        path: '/air/site',
        name: 'AirSite',
        meta: {
          title: '站点管理'
        },
        component: () => import('@/views/theApp/site/index'),
        props: {
          monitorType: 'airtype'
        }
      },
      {
        path: '/air/monitor',
        name: 'AirMonitor',
        meta: {
          title: '数据监测'
        },
        component: () => import('@/views/theApp/monitor/index'),
        props: {
          monitorType: 'airtype'
        }
      },
      {
        path: '/air/warning',
        name: 'AirWarning',
        meta: {
          title: '报警查询'
        },
        component: () => import('@/views/theApp/warning/index'),
        props: {
          monitorType: 'airtype'
        }
      },
      {
        path: '/air/report',
        name: 'AirReport',
        meta: {
          title: '监测报告'
        },
        component: () => import('@/views/theApp/report/index'),
        props: {
          monitorType: 'airtype'
        }
      },
      {
        path: '/air/accredit',
        name: 'AirAccredit',
        meta: {
          title: '企业授权'
        },
        component: () => import('@/views/theApp/accredit/index'),
        props: {
          monitorType: 'airtype'
        }
      }
    ]
  },
  {
    path: '/noise',
    name: 'Noise',
    meta: {
      title: '空气监测'
    },
    component: RouteEmpty,
    children: [
      {
        path: '/noise/site',
        name: 'NoiseSite',
        meta: {
          title: '站点管理'
        },
        component: () => import('@/views/theApp/site/index'),
        props: {
          monitorType: 'noisetype'
        }
      },
      {
        path: '/noise/monitor',
        name: 'NoiseMonitor',
        meta: {
          title: '数据监测'
        },
        component: () => import('@/views/theApp/monitor/index'),
        props: {
          monitorType: 'noisetype'
        }
      },
      {
        path: '/noise/warning',
        name: 'NoiseWarning',
        meta: {
          title: '报警查询'
        },
        component: () => import('@/views/theApp/warning/index'),
        props: {
          monitorType: 'noisetype'
        }
      },
      {
        path: '/noise/report',
        name: 'NoiseReport',
        meta: {
          title: '监测报告'
        },
        component: () => import('@/views/theApp/report/index'),
        props: {
          monitorType: 'noisetype'
        }
      },
      {
        path: '/noise/accredit',
        name: 'NoiseAccredit',
        meta: {
          title: '企业授权'
        },
        component: () => import('@/views/theApp/accredit/index'),
        props: {
          monitorType: 'noisetype'
        }
      }
    ]
  },
  {
    path: '/water',
    name: 'Water',
    meta: {
      title: '空气监测'
    },
    component: RouteEmpty,
    children: [
      {
        path: '/water/site',
        name: 'WaterSite',
        meta: {
          title: '站点管理'
        },
        component: () => import('@/views/theApp/site/index'),
        props: {
          monitorType: 'watertype'
        }
      },
      {
        path: '/water/monitor',
        name: 'WaterMonitor',
        meta: {
          title: '数据监测'
        },
        component: () => import('@/views/theApp/monitor/index'),
        props: {
          monitorType: 'watertype'
        }
      },
      {
        path: '/water/warning',
        name: 'WaterWarning',
        meta: {
          title: '报警查询'
        },
        component: () => import('@/views/theApp/warning/index'),
        props: {
          monitorType: 'watertype'
        }
      },
      {
        path: '/water/report',
        name: 'WaterReport',
        meta: {
          title: '监测报告'
        },
        component: () => import('@/views/theApp/report/index'),
        props: {
          monitorType: 'watertype'
        }
      },
      {
        path: '/water/accredit',
        name: 'WaterAccredit',
        meta: {
          title: '企业授权'
        },
        component: () => import('@/views/theApp/accredit/index'),
        props: {
          monitorType: 'watertype'
        }
      }
    ]
  },
  {
    path: '/smoke',
    name: 'Smoke',
    meta: {
      title: '空气监测'
    },
    component: RouteEmpty,
    children: [
      {
        path: '/smoke/site',
        name: 'SmokeSite',
        meta: {
          title: '站点管理'
        },
        component: () => import('@/views/theApp/site/index'),
        props: {
          monitorType: 'smoketype'
        }
      },
      {
        path: '/smoke/monitor',
        name: 'SmokeMonitor',
        meta: {
          title: '数据监测'
        },
        component: () => import('@/views/theApp/monitor/index'),
        props: {
          monitorType: 'smoketype'
        }
      },
      {
        path: '/smoke/warning',
        name: 'SmokeWarning',
        meta: {
          title: '报警查询'
        },
        component: () => import('@/views/theApp/warning/index'),
        props: {
          monitorType: 'smoketype'
        }
      },
      {
        path: '/smoke/report',
        name: 'SmokeReport',
        meta: {
          title: '监测报告'
        },
        component: () => import('@/views/theApp/report/index'),
        props: {
          monitorType: 'smoketype'
        }
      },
      {
        path: '/smoke/accredit',
        name: 'SmokeAccredit',
        meta: {
          title: '企业授权'
        },
        component: () => import('@/views/theApp/accredit/index'),
        props: {
          monitorType: 'smoketype'
        }
      }
    ]
  },
  {
    path: '/dust',
    name: 'Dust',
    meta: {
      title: '空气监测'
    },
    component: RouteEmpty,
    children: [
      {
        path: '/dust/site',
        name: 'DustSite',
        meta: {
          title: '站点管理'
        },
        component: () => import('@/views/theApp/site/index'),
        props: {
          monitorType: 'dusttype'
        }
      },
      {
        path: '/dust/monitor',
        name: 'DustMonitor',
        meta: {
          title: '数据监测'
        },
        component: () => import('@/views/theApp/monitor/index'),
        props: {
          monitorType: 'dusttype'
        }
      },
      {
        path: '/dust/warning',
        name: 'DustWarning',
        meta: {
          title: '报警查询'
        },
        component: () => import('@/views/theApp/warning/index'),
        props: {
          monitorType: 'dusttype'
        }
      },
      {
        path: '/dust/report',
        name: 'DustReport',
        meta: {
          title: '监测报告'
        },
        component: () => import('@/views/theApp/report/index'),
        props: {
          monitorType: 'dusttype'
        }
      },
      {
        path: '/dust/accredit',
        name: 'DustAccredit',
        meta: {
          title: '企业授权'
        },
        component: () => import('@/views/theApp/accredit/index'),
        props: {
          monitorType: 'dusttype'
        }
      }
    ]
  }
]
const routes = [
  {
    path: '/',
    name: 'Home',
    redirect: '/welcome',
    component: RouteLayout,
    children: [
      {
        path: 'welcome',
        name: 'Welcome',
        meta: {
          title: '系统登录默认页面'
        },
        component: () => import('@/views/index.vue')
      },
      ...asyncRoutes
    ]
  },
  {
    path: '/login',
    name: 'Login',
    meta: {
      title: '系统登录'
    },
    component: () => import('@/views/auth/login/index.vue')
  },
  {
    path: '/login-success',
    name: 'AuthBack',
    meta: {
      title: '第三方认证回调'
    },
    component: () => import('@/views/auth/AuthBack.vue')
  },
  {
    path: '/demo',
    name: 'Demo',
    redirect: '/demo/echarts',
    component: () => import('@/views/Demo.vue'),
    children: [
      {
        path: '/demo/echarts',
        name: 'Echarts',
        component: () => import('@/views/demo/Echart.vue')
      },
      {
        path: '/demo/search',
        name: 'Search',
        component: () => import('@/views/demo/search.vue')
      },
      {
        path: '/demo/menu',
        name: 'Menu',
        component: () => import('@/views/demo/Menu.vue')
      },
      {
        path: '/demo/container',
        name: 'Container',
        component: () => import('@/views/demo/Container.vue')
      },
      {
        path: '/demo/listview',
        name: 'ListView',
        component: () => import('@/views/demo/List.vue')
      },
      {
        path: '/demo/formpanel',
        name: 'DemoFormPanel',
        component: () => import('@/views/demo/DemoFormPanel.vue')
      },
      {
        path: '/demo/drawer',
        name: 'DemoDrawer',
        component: () => import('@/views/demo/Drawer.vue')
      },
      {
        path: '/demo/forminput',
        name: 'FormInput',
        component: () => import('@/views/demo/FormInput.vue')
      },
      {
        path: '/demo/tablelist',
        name: 'TableList',
        component: () => import('@/views/demo/TableList.vue')
      }
    ]
  }
]

const router = new VueRouter({
  mode: 'hash',
  base: '/',
  routes
})
export { asyncRoutes }
export default router
